/* $Header: sig_diag.c,v 2.2 01/10/02 10:33:03 przybyls Exp $ */

/***********************************************************************/
/*                                                                     */
/*                  Copyright Hewlett-Packard Co. 1991                 */
/*                                                                     */
/***********************************************************************/

/***********************************************************************/
/* MODULE NAME:  sig_diag.c                                            */
/* ============                                                        */
/*                                                                     */
/* Author:  Lesley Freed                                               */
/*                                                                     */
/* MODULE PURPOSE:  To define all of the functions used in test and    */
/*                  diagnostics for the signal path.                   */
/*                                                                     */
/*                                                                     */
/*                                                                     */
/***********************************************************************/


/*****************************/
/*   GLOBAL INCLUDE FILES    */
/*****************************/

#include <typedefs.h>
#include <exception.h>
#include <err_handler.h>
#include <dsp.h>

/*****************************/
/*   LOCAL INCLUDE FILES     */
/*****************************/


/*****************************/
/*   GLOBAL VARIABLES        */
/*****************************/

/*****************************/
/*   EXTERNAL VARIABLES      */
/*****************************/


/*****************************/
/*   LOCAL DEFINES           */
/*****************************/


/*****************************/
/*   STATIC VARIABLES        */
/*****************************/



/*****************************/
/*   IMPLEMENT SECTION       */
/*****************************/


void SetSignalDspFault( BIT8 dsp_status )
{
   EXCEPTION flag;
/*
The following error codes will be returned:

                     00 =  OK

                     10 =  Task_1K didn't finish before next call
                     20 =  Task_100 didn't finish before next call
                     30 =  Task_100 called before data was available

                     90 =  ROM Checksum Error
                     a0 =  RAM Test Error
                     b0 =  Register Test Error
                     ff =  DSP Failed startup test horribly
*/
   switch( dsp_status & SIG_DSP_TESTS_MASK )
   {
      case 0x90:   flag   = SIG_DSP_ROM_ERR;
                   break;

      case 0xa0:   flag   = SIG_DSP_RAM_ERR;
                   break;

      case 0xb0:   flag   = SIG_DSP_REG_ERR;
                   break;

      default:     flag   = SIG_DSP_FAULT;
                   break;
   }
   SetNewException( flag, 0, 0 );
}

